package com.yal.timer.task;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author Kimiaaaaa
 * @date 2022年04月19日 15:03
 */
@Component
public class Task {

    @Scheduled(fixedRate = 5000)
    @Async
    public void task() throws Exception {
        System.out.println(new Date().toString() + "FuFu 暖你一整天");
    }

    @Scheduled(fixedRate = 5000)
    @Async
    public void task2() throws Exception {
        try {
            Thread.sleep(9000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(new Date().toString() + "FuFu 暖她一整天");
    }


}
